package day6.ObLong;

import java.util.Scanner;

import org.junit.Test;

public class Demo {
	@Test
	public void test1() {
		ObLong obLong = new ObLong();
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入长方形的宽度：");
		obLong.setWidth(scanner.nextInt()); 
		System.out.println("请输入长方形的高度");
		obLong.setHigh(scanner.nextInt());
		
		int type = 1;
		
		while(type != 0) {
			
		System.out.println("*************");
		System.out.println("功能选择：");
		System.out.println("求周长：1");
		System.out.println("求面积：2");
		System.out.println("退出：0");
		
		System.out.println("*************");

		type = scanner.nextInt();
		int result;
		
		switch (type) {
		case 1:
			
			result = obLong.circumferen(obLong.getHigh(), obLong.getWidth());
			break;
		case 2:
			result = obLong.area(obLong.getHigh(), obLong.getWidth());

			break;

		default:
			if(type != 0) {
				System.out.println("输入错误！");					
			}else {
				System.out.println("已退出");
			}
			break;
		}
		}
	}

}
